package org.example.adapter;

public class MediaAdapter implements AudioPlayer{
    private VideoPlayer videoPlayer;
    public MediaAdapter(String audioType){
        if(audioType.equals("mp4")){
            videoPlayer = new Mp4Player();
        }
        if(audioType.equals("vlc")){
            videoPlayer = new VlcPlayer();
        }
    }
    @Override
    public void playMp3(String audioType) {
        if(audioType.equals("mp4")){
            videoPlayer.playMp4(audioType);
        }
        if(audioType.equals("vlc")){
            videoPlayer.playVlc(audioType);
        }
    }

    public static void main(String[] args) {
        String s = null;
        System.out.println((s==null) | (s.length()==0) );
        System.out.println("1:"+s!=null);
        System.out.println("2:"+s==null);
    }

    public static int div(int a, int b) {
        try {
            return a / b;
        } catch (ArithmeticException e) {
            System.out.print("ArithmeticException ");
        } catch (NullPointerException e) {
            System.out.print("NullPointerException ");
        } catch (Exception e) {
            System.out.print("Exception ");
        } finally {
            System.out.print("finally ");
        }
        return 0;
    }



}
